/**
 * filesource:				admin_common.js
 * desc:					后台通用JS函数库
 * 
 * author:					houyining
 * coryright:				hou.yining@gmail.com
 * date:					2011-04-04
 */

//定义ajax动画路径
var loadingPath = "/Public/images/ajaxloading.gif";

//刷新验证码
function refreshVerify(){
	document.getElementById('verifyImg').src='verify/'+Math.random();
}

//定义ajax表单提交参数
var options = {
		target:				'#note',
		beforeSubmit:		beforeProcess,
		success:			successResponse,
		dataType:			'json',
		timeout:			3000,
		};

//提交前进行校验
function beforeProcess(needValidate, validateMethod){
	$(options.target).html("<img src='" + loadingPath + "' />").show();
	if(needValidate == true){
		eval(validateMethod);
	}	
}
//ajax 响应
function successResponse(responseText, statusText, xhr, $form){
	if(statusText == 'success'){
		if(responseText.status == 1){
			$(options.target).html("<strong>"+ responseText.info + "</strong>");
			window.location = 'index';
		}else{
			$(options.target).html("<strong>"+ responseText.info + "</strong>").hide(5000);
		}
	}	
}

//验证函数
function validate(){
	
}

